package com.example.service.shenhe.impl;

import com.example.dao.shenhe.Shproduct;
import com.example.pojo.CourseRecord;
import com.example.service.shenhe.Shproductservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * @ClassName: ***
 * @Description: ***
 * @author: ***
 * @date: 2022/12/20 14:59
 */
@Service
public class ShproductserviceImpl implements Shproductservice {
    @Autowired
    private Shproduct shproduct;

    //查询分类表
    public List all(){
        return shproduct.all();
    }

    //分类
    public List productclass(){
        return shproduct.productclass();
    }

    //模糊查
    public List mo(String productName, String categroyId, BigDecimal currentpriceProduct){
        return shproduct.mo(productName,categroyId,currentpriceProduct);
    }

    /**
     * @Author: zdp
     * @Description: 审核课程，修改课程审核状态、添加审核记录表
     * @DateTime: 11:50 2022/12/16
     * @Params:
     * @Return
     */
    public int shenhe(CourseRecord courseRecord){
        int a = 0;
        String result = courseRecord.getResult();
        if(result.equals("审核不通过")){
            a=4;
        }else{
            a=5;
        }
        int zhuangtai = shproduct.zhuangtai(a, courseRecord.getCourseId());
        int shehe = shproduct.shenhe(courseRecord);
        if(zhuangtai>0&&shehe>0){
            return 2;
        }
        return 1;
    }
    /**
    * @Author: zdp
    * @Description: 批量修改
    * @DateTime: 13:52 2023/2/1
    * @Params:
    * @Return
    */
    public int piliang(List<Integer> s1, int producctId){
        for (Integer o : s1) {
            int zhuangtai = shproduct.zhuangtai(producctId, o);
        }
        return 1;
    }
}
